package de.pernpas.stadtfuehrer.managedbean;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import de.pernpas.stadtfuehrer.entity.User;
import de.pernpas.stadtfuehrer.service.UserService;
import de.pernpas.stadtfuehrer.service.UserServiceImpl;

@ManagedBean
@RequestScoped
public class RegisterMB {
	private static final String REGISTERED_OUTCOME = "registered";
	private User newUser;
	private UserService us; 

	@PostConstruct
	public void init(){
		newUser = new User();
	}
	
	public String register(){
		us = new UserServiceImpl();
		us.create(newUser);
		return REGISTERED_OUTCOME;
	}
	
	public User getNewUser() {
		return newUser;
	}

	public void setNewUser(User newUser) {
		this.newUser = newUser;
	}
}
